//
//  WmcCPFeedbackTitleView.swift
//  YPWatermarkCamera
//
//  Created by Json on 2023/8/1.
//

import UIKit

class WmcCPFeedbackTitleView: WmcBaseView {
    
    /// 标题
    private lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.font = 15.wmc_scaleFont(weight: .medium)
        label.textColor = UIColor.wmc_blackH1_000000
        label.textAlignment = .center
        return label
    }()
    
    /// 关闭按钮
    private(set) lazy var closeButton: UIButton = {
        let button = UIButton()
        button.setImage("close".wmc_image, for: .normal)
        return button
    }()
    
    /// 分割线
    private lazy var lineView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.wmc_lineColor
        return view
    }()
    
    var title: String = "" {
        didSet {
            titleLabel.text = title
        }
    }
    
    
    override func makeUI() {
        super.makeUI()
        let hMargin = 16.0.wmc_autoHor
        let closeW = 24.0.wmc_autoHor
        // 关闭按钮
        addSubview(closeButton)
        closeButton.snp.makeConstraints { make in
            make.right.equalTo(-hMargin)
            make.width.equalTo(closeW)
            make.top.bottom.equalToSuperview()
        }
        // 标题
        addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.right.equalTo(closeButton.snp.left).offset(-8.0)
            make.center.equalToSuperview()
        }
        // 分割线
        addSubview(lineView)
        lineView.snp.makeConstraints { make in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(1.0)
        }
        
    }
    

}
